/*
 * main.cpp
 *
 *  Created on: May 2, 2011
 *      Author: default
 */


#include "SDL/SDL.h"
#include "SDL/SDL_image.h"
#include <string>
#include "MainGame.h"
#include <iostream>

using namespace std;


int main(){

	bool exit = false;
	SDL_Event event;
	gMainGame.init();
	int x, y;
	while (exit == false){
		while( SDL_PollEvent( &event ) )
		{
			if(event.type == SDL_MOUSEBUTTONDOWN){
				x = event.button.x;
				y = event.button.y;
				gMainGame.onClick(x, y);
			}
			if(event.type == SDL_KEYDOWN){
				if(event.key.keysym.sym == SDLK_ESCAPE){
					SDL_Quit();
					SDL_FreeSurface(gMainGame.m_Screen);
					exit = true;
				}
			}
		}
		gMainGame.onDraw();
	}

	return 0;
}
